package com.loan.job.service;

import com.loan.system.service.ApplyService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author shiguang on 2022/9/21 11:21
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class ApplyJobService {

    private final ApplyService applyService;

    /**
     * 计算每日利息
     * @throws Exception
     */
    @XxlJob("statisticsApplyInterestByDayHandler")
    public void statisticsApplyInterestByDay() throws Exception {
        XxlJobHelper.log("run StatisticsApplyInterestByDay.");
        applyService.calculationApplyInterestByDay();
    }

    /**
     * 计算逾期
     * @throws Exception
     */
    @XxlJob("updateOverApply")
    public void updateOverApply() throws Exception {
        XxlJobHelper.log("run updateOverApply.");
        applyService.updateOverApply();
    }

    /**
     * 每日更新提现过期订单
     * @throws Exception
     */
    @XxlJob("updateApplyWithdrawalStatus")
    public void updateApplyWithdrawalStatus() throws Exception{
        XxlJobHelper.log("run updateOverApply.");
        applyService.updateApplyWithdrawalStatus();
    }

    /**
     * 机审
     * @throws Exception
     */
    @XxlJob("robotApply")
    public void robotApply() throws Exception{
        XxlJobHelper.log("run robotApply.");
        applyService.robotApply();
    }
}
